#include "EventPoller.h"
#include <SDL.h>

void EventPoller::Update()
{
	SDL_Event event;
	Handlers handlers = m_handlers;

	while (SDL_PollEvent(&event))
	{
		if (event.type == SDL_QUIT)
		{
			exit(0);
		}

		for (Handlers::iterator it = handlers.begin(); it != handlers.end(); ++it)
		{
			(*it)->HandleEvent(event);
		}
	}
}
							//eh = event handler
void EventPoller::AddHandler(EventHandler* eh)
{
	m_handlers.insert(eh);
}
